package com.example.utils;
import com.example.spzx.model.entity.system.SysUser;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpSession;

public class AuthContextUtil {

    private static final ThreadLocal<SysUser> threadLocal=new ThreadLocal<>();
    public static void set(SysUser sysUser){
        threadLocal.set(sysUser);
    }
    public static SysUser get(HttpSession httpSession){
//        System.out.println(threadLocal.get()+"thrend");
//        return threadLocal.get();
        return (SysUser) httpSession.getAttribute("login");
    }
    public static void remove(){
        threadLocal.remove();
    }


}
